/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.yihu.wlyy.entity.follow.FollowUpItemRecordQuestionOption;

public interface FollowUpItemRecordQuestionOptionDao extends PagingAndSortingRepository<FollowUpItemRecordQuestionOption, Long>, JpaSpecificationExecutor<FollowUpItemRecordQuestionOption> {
	
	List<FollowUpItemRecordQuestionOption> findByPlanAndStageAndItemAndRecordAndQuestion(String plan,String stage,String item,String record,String question);

	@Query("select a from FollowUpItemRecordQuestionOption a where a.question = ?1 ")
	List<FollowUpItemRecordQuestionOption> getFollowUpItemRecordQuestionOptionByQuestionCode(
			String code);

	@Query("select a from FollowUpItemRecordQuestionOption a where a.code = ?1 ")
	FollowUpItemRecordQuestionOption findByCode(String option);

	@Query("select a from FollowUpItemRecordQuestionOption a where a.record = ?1 and a.question=?2")
	List<FollowUpItemRecordQuestionOption> findByRecordAndQuestion(String recoredCode,String querstionCode);

}
